C Application: Simulating a Perfect Shuffle

C Application: Simulating a Perfect Shuffle

People learning to program often struggle with how to decompose a problem into the steps necessary to write a program to solve that problem. This is one of a series of posts in which I take a problem and go through my decision-making process that leads to a program. Background: I once attended a presentation by an amateur magician in which he stated that performing 8 perfect shuffles in a row on a deck of 52 cards returned the deck…

Read More Read More

Text Processing in Linux

Text Processing in Linux

I originally created and posted this November 22, 2004. Here are some examples of using the utilities found on Unix (available on some other platforms also) for manipulating the text in files. awk and perl both allow writing full programs, but I primarily use both as short one-liner programs which allows them to be piped to/from other Unix programs. Each of these programs has capabilities that make it better than the others in some situations which I have attempted to…

Read More Read More

bash Shell Examples

bash Shell Examples

I originally created this on June 23, 2004. These examples primarily use the for loop in the bash shell. Count the number of lines with the_word in each .txt file for file in *.txt; do grep the_word $file | wc -l done This code creates directories (under the current directory, as written) for any groups whose names begin with dev-. for GRP in `getent group | cut -d: -f1 | grep ^dev-`; do mkdir $GRP done Create directories named dev1,…

Read More Read More

Unix find Examples

Unix find Examples

I originally created and posted these online on March 8, 2000. To recursively remove all files with a given name starting at the current directory, e.g., files called undo.Z, use find . -name undo.Z -exec rm {} \; To recursively move to the directory ~/public_html/cgi-bin/ all files belonging to user brezeald, use find . -user brezeald -exec mv {} ~/public_html/cgi-bin/ \; To recursively find all files with the name hosts starting at the current directory, use find . -name hosts…

Read More Read More

Python Programming: Producing a Multiplication Table

Python Programming: Producing a Multiplication Table

People learning to program often struggle with how to decompose a problem into the steps necessary to write a program to solve that problem. This is one of a series of posts in which I take a problem and go through my decision-making process that leads to a program. The problem: produce a multiplication table. I assume that at this point you know about statements, conditionals, loops, and functions. You can find a video with more details at https://youtu.be/QJqfYn_4pmw. Design…

Read More Read More

vi/vim notes

vi/vim notes

I first created and posted these notes online on May 28, 2002. They may be the most useful thing I ever do. I collected most of these over the years from several sources, but I can’t give proper credit since those links are all dead now. Changing Text cc change a line C change from current cursor position to the end-of-line cw change from current cursor position to the end of the word J joins the next line to the…

Read More Read More

UTA stuff

UTA stuff

For many years I worked at the University of Texas at Arlington. While there I taught the following courses: LegendCSE 1301 – Computer LiteracyCSE 1310 – Introduction to Computers and Programming    C version (ended 2010)    Python version (ended 2015)    Java version (beginning fall 2015)CSE 1311 – Introductory Programming for Engineers and ScientistsCSE 1320 – Intermediate ProgrammingCSE 2312 – Computer Organization and Assembly Language ProgrammingCSE 2315 – Discrete StructuresCSE 2320 – Data Structures and AlgorithmsCSE 3313 – Introduction…

Read More Read More