Skip to main content

Posts

Thinking the TakeCommand way.

As you know, I'm a fan of using TakeCommand on Windows. It's a great interactive shell but it also provides some pretty powerful scripting tools too.  Personally, I wouldn't write long scripts in it but it's adequate for many tasks and certainly better than CMD.EXE.  That's just torture.

TLDR;

Functions, not piping, for the win.

Long form:

Using TakeCommand is not like using Unix shells, like Bash or KornShell.  The Windows operating system is more function-oriented than byte stream-oriented.  Piping is possible but not natural.

As a result, it took me a long time to figure out a simple problem.

Find the total amount of space that my index.js files occupy, in a tree of directories?

I tried piping.  On Unix, it's a one liner:

find . -name index.js -printf "%s %p\n" |awk 'BEGIN{sum=0}{ sum+=$1 }END{print sum}'

But that actually doesn't work correctly under the new Bash on Windows.  File sizes appear to be messed up.

I tried the FOR loop in Ta…
Recent posts

Comment your data

Introduction
I am a big believer in embedding comments in data files.

This has always served me well. I'm hoping this short essay will convince you to do the same.

Kinds of things you could write as comments Here is a short list of things that can 
Describe the data file layout and structureDescribe why the structure is what it isDescribe legal valuesDescribe what changes are allowedDescribe the history of changesDescribe what program uses this data fileDescribe assumptions about the data fileInclude the checksum or digital signature for the fileSeparate out clumps of records for readabilityComment out records with problemsDescribe what version of the data schema is in useInclude a URL to the descriptive wiki pageInclude a copyright or license
In many ways, this is similar to how JavaDocs is embedded in an application. The idea is to keep the documentation near the data, just like JavaDocs keeps the docs near the code.

Formats which allow comments
By the way, the demarcation betwe…

Microservice architectures and the IBM Mainframe - Recollections of similarity

As I learn about Docker, containerization, and micro-services, I can't help but think we've been down (part of) this road before.  Without a doubt, there's a lot of innovation in Docker, so don't misunderstand me.  However, I want to acknowledge the good parts of what I experienced long ago in my limited experience on IBM mainframes and perhaps there are some lessons to be learned here as well.

My experience on mainframes was using the IBM VM/ESA operating system from 1992-1994 at IBM's Boca Raton facility ("Home of the PC").  VM/ESA (now known as z/VM) is a (some would say "the") virtual machine operating system.  It has a history which is nearly as old as UNIX.

One thing you have to know about VM/ESA is that it divides a mainframe up into thousands of virtual machines, each of which runs a single user, single tasking operating system called CMS (conversational monitor system).  CMS is much like MSDOS (in my opinion).   As a result, it is a pr…

Why Fossil-SCM is an excellent choice for introductory programming courses

Fossil SCM for introductory programming courses The use of source control management (or version control - take your pick) is an important skill for new programmers to adopt.  It is expected that all programmers use SCM in their daily jobs, in order to coordinate changes among team members.  Thus, getting beginners to adopt good habits early should be a goal.

While GIT (git-scm.com)  is certainly the dominant source control system of today, I believe instructors of introductory classes in programming should consider an alternative called Fossil (fossil-scm.org).

Fossil has several compelling advantages in education over GIT.  You will see that I value the practical aspects of Fossil even more than its technical capabilities.  After all, an instructor has a limited amount of time to have an impact and they don't want to waste time doing technical support on a tool that is too complex.  Helping one or two people is fine but helping 30 can be a real burden.

Simple installation and …

My favorite feature of REXX and the one I miss most in other languages

I'm a pretty relaxed programmer.   I like a programming feature that is so intuitive that I can remember how to use it without a reference manual and without Google.

REXX was invented to make string processing easy, at a time when there were few choices.   That's an apology because you won't see things like regular expressions natively in REXX.  But here's the kicker - you don't need them.  REXX has a simple syntax that is easy to remember and use.  It is not as powerful as PERL or Python - it was not made for that audience. It is a tool that lets regular people be productive without remembering a ton of rules.
s = 'this is my string' if I want the 3rd word, type :
say word(s, 3) dt = '10/20/2030' The feature I like most is the "parse var" command.
The basic form is:


parse var sourcevar target1 separator target2 separator2 ... .The '.' character represents a throwaway item.  The last target in the command gets the remainder of the stri…

Joy of TCC and Take Command - Directory and Command history

Did you know you can pre-populate your directory and command histories?

Why would you want to do that?  Well, when I'm doing software development, my project directories often require a lot of navigation.  I already know what directories I'm going to be using most.  So, I put them into the directory history  using the dirhistory command.

dirhistory /a src\node
dirhistory /a src\lib

That way, i can simply press control-page up and quickly select the directory to change to.

I also use gulp a lot so I like to have it in my history right away.  That's easy in TakeCommand:

history /a gulp

That's it.

Now, when I press Control-PgUp, I get the directories I prepopulated. When I press PgUp, I get the history command I populated (e.g. "gulp").